package com.yycx.module.bus.provider.service.hy.impl;

import com.yycx.module.bus.client.entity.BusDept;
import com.yycx.module.bus.client.entity.hy.BusPolicyBonus;
import com.yycx.module.bus.client.entity.BusSaleman;
import com.yycx.module.bus.provider.mapper.hy.BusPolicyBonusMapper;
import com.yycx.module.bus.provider.service.hy.BusPolicyBonusService;
import com.yycx.common.mybatis.base.service.impl.BaseServiceImpl;
import com.yycx.common.mybatis.model.ResultBody;
import org.springframework.stereotype.Service;
import com.yycx.common.base.entity.EntityMap;
import com.yycx.common.mybatis.query.CriteriaQuery;
import org.springframework.transaction.annotation.Propagation;
import com.yycx.common.mybatis.query.CriteriaSave;
import org.springframework.transaction.annotation.Transactional;

/**
 * 分红政策详情接口实现类
 *
 * @author flyme
 * @date 2023-07-19
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BusPolicyBonusServiceImpl extends BaseServiceImpl<BusPolicyBonusMapper, BusPolicyBonus> implements BusPolicyBonusService {

    @Override
    public ResultBody beforeAdd(CriteriaSave cs, BusPolicyBonus bpb, EntityMap extra) {
        return ResultBody.ok();
    }



    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
    public ResultBody beforePageList(CriteriaQuery<BusPolicyBonus> cq, BusPolicyBonus bpb, EntityMap requestMap) {
        cq.select(BusPolicyBonus.class, "*" );
        cq.eq(BusPolicyBonus.class, "policyDrugId" );
        cq.addSelect(BusSaleman.class, "saleManName" );
        cq.addSelect(BusDept.class, "deptName" );
        cq.orderByDesc("bpb.createTime" );
        cq.createJoin(BusSaleman.class);
        cq.createJoin(BusDept.class);
      return ResultBody.ok();
    }
}
